// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Elastic.Clients.Elasticsearch.Tasks;

public partial class TasksNamespacedClient : NamespacedClientProxy
{
	/// <summary>
	/// <para>
	/// Initializes a new instance of the <see cref="TasksNamespacedClient"/> class for mocking.
	/// </para>
	/// </summary>
	protected TasksNamespacedClient() : base()
	{
	}

	internal TasksNamespacedClient(ElasticsearchClient client) : base(client)
	{
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual CancelResponse Cancel(CancelRequest request)
	{
		request.BeforeRequest();
		return DoRequest<CancelRequest, CancelResponse, CancelRequestParameters>(request);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<CancelResponse> CancelAsync(CancelRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<CancelRequest, CancelResponse, CancelRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual CancelResponse Cancel(CancelRequestDescriptor descriptor)
	{
		descriptor.BeforeRequest();
		return DoRequest<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual CancelResponse Cancel(Elastic.Clients.Elasticsearch.TaskId? taskId)
	{
		var descriptor = new CancelRequestDescriptor(taskId);
		descriptor.BeforeRequest();
		return DoRequest<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual CancelResponse Cancel(Elastic.Clients.Elasticsearch.TaskId? taskId, Action<CancelRequestDescriptor> configureRequest)
	{
		var descriptor = new CancelRequestDescriptor(taskId);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequest<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual CancelResponse Cancel()
	{
		var descriptor = new CancelRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequest<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual CancelResponse Cancel(Action<CancelRequestDescriptor> configureRequest)
	{
		var descriptor = new CancelRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequest<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<CancelResponse> CancelAsync(CancelRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<CancelResponse> CancelAsync(Elastic.Clients.Elasticsearch.TaskId? taskId, CancellationToken cancellationToken = default)
	{
		var descriptor = new CancelRequestDescriptor(taskId);
		descriptor.BeforeRequest();
		return DoRequestAsync<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<CancelResponse> CancelAsync(Elastic.Clients.Elasticsearch.TaskId? taskId, Action<CancelRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new CancelRequestDescriptor(taskId);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<CancelResponse> CancelAsync(CancellationToken cancellationToken = default)
	{
		var descriptor = new CancelRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequestAsync<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Cancels a task, if it can be cancelled through an API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<CancelResponse> CancelAsync(Action<CancelRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new CancelRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<CancelRequestDescriptor, CancelResponse, CancelRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get task information.
	/// Returns information about the tasks currently executing in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual GetTasksResponse Get(GetTasksRequest request)
	{
		request.BeforeRequest();
		return DoRequest<GetTasksRequest, GetTasksResponse, GetTasksRequestParameters>(request);
	}

	/// <summary>
	/// <para>
	/// Get task information.
	/// Returns information about the tasks currently executing in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetTasksResponse> GetAsync(GetTasksRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<GetTasksRequest, GetTasksResponse, GetTasksRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get task information.
	/// Returns information about the tasks currently executing in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual GetTasksResponse Get(GetTasksRequestDescriptor descriptor)
	{
		descriptor.BeforeRequest();
		return DoRequest<GetTasksRequestDescriptor, GetTasksResponse, GetTasksRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// Get task information.
	/// Returns information about the tasks currently executing in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual GetTasksResponse Get(Elastic.Clients.Elasticsearch.Id taskId)
	{
		var descriptor = new GetTasksRequestDescriptor(taskId);
		descriptor.BeforeRequest();
		return DoRequest<GetTasksRequestDescriptor, GetTasksResponse, GetTasksRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// Get task information.
	/// Returns information about the tasks currently executing in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual GetTasksResponse Get(Elastic.Clients.Elasticsearch.Id taskId, Action<GetTasksRequestDescriptor> configureRequest)
	{
		var descriptor = new GetTasksRequestDescriptor(taskId);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequest<GetTasksRequestDescriptor, GetTasksResponse, GetTasksRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// Get task information.
	/// Returns information about the tasks currently executing in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetTasksResponse> GetAsync(GetTasksRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<GetTasksRequestDescriptor, GetTasksResponse, GetTasksRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get task information.
	/// Returns information about the tasks currently executing in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetTasksResponse> GetAsync(Elastic.Clients.Elasticsearch.Id taskId, CancellationToken cancellationToken = default)
	{
		var descriptor = new GetTasksRequestDescriptor(taskId);
		descriptor.BeforeRequest();
		return DoRequestAsync<GetTasksRequestDescriptor, GetTasksResponse, GetTasksRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get task information.
	/// Returns information about the tasks currently executing in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetTasksResponse> GetAsync(Elastic.Clients.Elasticsearch.Id taskId, Action<GetTasksRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new GetTasksRequestDescriptor(taskId);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<GetTasksRequestDescriptor, GetTasksResponse, GetTasksRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The task management API returns information about tasks currently executing on one or more nodes in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual ListResponse List(ListRequest request)
	{
		request.BeforeRequest();
		return DoRequest<ListRequest, ListResponse, ListRequestParameters>(request);
	}

	/// <summary>
	/// <para>
	/// The task management API returns information about tasks currently executing on one or more nodes in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ListResponse> ListAsync(ListRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<ListRequest, ListResponse, ListRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The task management API returns information about tasks currently executing on one or more nodes in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual ListResponse List(ListRequestDescriptor descriptor)
	{
		descriptor.BeforeRequest();
		return DoRequest<ListRequestDescriptor, ListResponse, ListRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// The task management API returns information about tasks currently executing on one or more nodes in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual ListResponse List()
	{
		var descriptor = new ListRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequest<ListRequestDescriptor, ListResponse, ListRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// The task management API returns information about tasks currently executing on one or more nodes in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	[Obsolete("Synchronous methods are deprecated and could be removed in the future.")]
	public virtual ListResponse List(Action<ListRequestDescriptor> configureRequest)
	{
		var descriptor = new ListRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequest<ListRequestDescriptor, ListResponse, ListRequestParameters>(descriptor);
	}

	/// <summary>
	/// <para>
	/// The task management API returns information about tasks currently executing on one or more nodes in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ListResponse> ListAsync(ListRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<ListRequestDescriptor, ListResponse, ListRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The task management API returns information about tasks currently executing on one or more nodes in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ListResponse> ListAsync(CancellationToken cancellationToken = default)
	{
		var descriptor = new ListRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequestAsync<ListRequestDescriptor, ListResponse, ListRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The task management API returns information about tasks currently executing on one or more nodes in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/tasks.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ListResponse> ListAsync(Action<ListRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new ListRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<ListRequestDescriptor, ListResponse, ListRequestParameters>(descriptor, cancellationToken);
	}
}